import React from "react";

import Form from "./Form";
import List from "./List";

import { useSelector, useDispatch } from "react-redux";

const App = () => {
  const count = useSelector((state) => state.counter.count);
  const dispatch = useDispatch();

  return (
    <>
      <h2>saga-todolist</h2>
      <Form />
      <List />

      <hr />

      <h2>计数器</h2>
      <button onClick={() => dispatch({ type: "decrement" })}>-</button>
      <span>{count}</span>
      <button onClick={() => dispatch({ type: "addAction" })}>+</button>
    </>
  );
};

export default App;
